/*
** 1401.c
** 
** Made by (seakage2h)
** Login   <seakage2h@seakage2h-ubuntu>
** 
** Started on  Fri Oct  3 20:55:06 2008 seakage2h
** Last update Sun May 12 01:17:25 2002 Speed Blue
*/

/* #include "1401.h" */
#include <stdio.h>

int main()
{
     int instance, power_5[13], zeros, target;
     int i;

     for(i = 1, power_5[0] = 5; i < 13; i++)
	  power_5[i] = power_5[i-1] * 5;

     scanf("%d", &instance);
     while(instance){
	  scanf("%d", &target);
	  zeros = 0;
	  for(i = 0; power_5[i] <= target; i++)
	       zeros += target / power_5[i];
	  printf("%d\n", zeros);
	  instance--;
     }

     return 0;
}

